﻿using WH.Model.Bases;
using SqlSugar;

namespace WH.Model.Systems
{
    ///<summary>
    ///系统模块表
    ///</summary>
    [SugarTable("sys_menu")]
    public class MenuEntity : BaseOrgAuditableEntity
    {
        /// <summary>
        /// 组件路径
        /// </summary>
        [SugarColumn(ColumnName = "component", IsNullable = true, Length = 255, ColumnDescription = "")]
        public string? Component { get; set; }

        /// <summary>
        /// 组件名称
        /// </summary>
        [SugarColumn(ColumnName = "component_name", IsNullable = true, Length = 255)]
        public string? ComponentName { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        [SugarColumn(ColumnName = "description", IsNullable = true, Length = 255)]
        public string? Description { get; set; }

        /// <summary>
        /// 是否隐藏
        /// </summary>
        [SugarColumn(ColumnName = "hidden", IsNullable = true, Length = 1)]
        public bool Hidden { get; set; }

        /// <summary>
        /// 图标地址 此处以layui举例：layui-icon-set
        /// </summary>           
        [SugarColumn(ColumnName = "icon", IsNullable = true, Length = 255)]
        public string? Icon { get; set; }

        ///// <summary>
        ///// 是否为叶子节点
        ///// </summary>
        //[SugarColumn(ColumnName = "is_leaf")]
        //public bool IsLeaf { get; set; }

        ///// <summary>
        ///// 是否有叶子节点
        ///// </summary>
        //[SugarColumn(ColumnName = "leaf")]
        //public bool Leaf { get; set; }

        /// <summary>
        /// 是否缓存
        /// </summary>
        [SugarColumn(ColumnName = "keep_alive", IsNullable = true, Length = 1)]
        public bool KeepAlive { get; set; }

        /// <summary>
        /// 菜单类型
        /// </summary>
        [SugarColumn(ColumnName = "menu_type", IsNullable = true, Length = 10)]
        public int? MenuType { get; set; }

        /// <summary>
        /// 名称 例如：系统设置
        /// </summary>           
        [SugarColumn(ColumnName = "name", IsNullable = false, Length = 50)]
        public string Name { get; set; } = null!;

        /// <summary>
        /// 父节点id 默认为0位顶节点
        /// </summary>      
        [SugarColumn(ColumnName = "parent_id", IsNullable = true, Length = 50)]
        public string ParentId { get; set; } = null!;


        /// <summary>
        /// 授权标识
        /// </summary>      
        [SugarColumn(ColumnName = "perms", IsNullable = true, Length = 255)]
        public string? Perms { get; set; }

        /// <summary>
        /// 授权策略
        /// </summary>      
        [SugarColumn(ColumnName = "perms_type", IsNullable = true, Length = 255)]
        public string? PermsType { get; set; }

        /// <summary>
        /// 跳转地址
        /// </summary>      
        [SugarColumn(ColumnName = "redirect", IsNullable = true, Length = 255)]
        public string? Redirect { get; set; }

        /// <summary>
        /// 路由组件
        /// </summary>      
        [SugarColumn(ColumnName = "route", IsNullable = true, Length = 1)]
        public bool Route { get; set; }

        /// <summary>
        /// 排序
        /// </summary>      
        [SugarColumn(ColumnName = "sort_no", IsNullable = true, Length = 11)]
        public int SortNo { get; set; }

        /// <summary>
        /// 状态
        /// </summary>      
        [SugarColumn(ColumnName = "status", IsNullable = true, Length = 1)]
        public bool Status { get; set; }

        /// <summary>
        /// 标题
        /// </summary>      
        [SugarColumn(ColumnName = "title", IsNullable = true, Length = 255)]
        public string Title { get; set; }

        /// <summary>
        /// 访问路劲
        /// </summary>      
        [SugarColumn(ColumnName = "url", IsNullable = true, Length = 255)]
        public string Url { get; set; }

        /// <summary>
        /// 打开方式
        /// </summary>      
        [SugarColumn(ColumnName = "internal_or_external", IsNullable = true, Length = 1)]
        public bool InternalOrExternal { get; set; }

        [SugarColumn(IsIgnore = true)]
        public List<MenuEntity> Children { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [SugarColumn(ColumnName = "organization_id", IsNullable = true, Length = 50, ColumnDescription = "机构id")]
        public override string OrganizationId { get; set; } = null!;

    }
}
